import React from 'react'
import { Link } from 'react-router-dom'

import { useSelector } from 'react-redux'

const Header = () => {
    const {isLogin} = useSelector((state)=>state) //返回的值会赋给obj
    // console.log(isLogin);
    return (
        <div style={{heighr:60,background:'#aaa'}}>
            <Link to='/'>首页</Link>
            <Link to='/about'>关于</Link>
            {
                isLogin
                ?<button>退出</button>
                :<Link to='/login'>登录</Link>
            }
            
        </div>
    )
}

export default Header
